package com.example.web;

import com.example.goods.entity.Goods;
import com.example.goods.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Author: HouZeYu
 * @Description:
 * @Date: Created in 9:21 2019/4/1
 */
@Controller
public class WebController {
    @Autowired
    @Qualifier("goodsServiceImpl")
    private GoodsService goodsService;

    @RequestMapping("/home")
    public String home(Model model){
       List<Goods> goodsList=goodsService.goodsList();
       List<Goods>  collectGoodsList=goodsService.collectGoodsList();
        model.addAttribute("goodsList",goodsList);
        model.addAttribute("collectGoodsList",collectGoodsList);
        return "home";

    }
    @RequestMapping("/")
    public String web(){
      return "redirect:/home";
    }
}
